import router from './router'
import store from './store'
import { getToken } from '@/utils/auth'

const whiteList = ['/index']
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  if (getToken()) {
    /* has token*/
      next()
  } else {
    // 没有token
    if (whiteList.indexOf(to.path) !== -1) {
      // 在免登录白名单，直接进入
      next()
    } else {
        next()
    }
  }
})
